<!doctype html>
<html class="no-js">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>{$meta_title}</title>

		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link rel="icon" type="image/png" href="">
		<link rel="apple-touch-icon-precomposed" href="">
		<meta name="apple-mobile-web-app-title" content="{$meta_title}" />
		<link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/amazeui.min.css" />
		<link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/admin.css">
		<link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/mycss.css">
		<script type="text/javascript" src="__PUBLIC__/libs/dingding/javascripts/zepto.min.js"></script>
		<script type="text/javascript" src="http://g.alicdn.com/dingding/dingtalk-pc-api/2.6.2/index.js"></script>

	</head>

	<body>
		<style>
			.page {
				clear: both;
				text-align: right;
				padding: 10px 10px 30px 10px;
				height: 40px;
			}
			
			.page li {
				display: inline;
				margin-right: 8px;
			}
			
			li.active.current a {
				background: #0e90d2;
				border: 1px solid #0e90d2;
				color: #fff;
			}
			
			.page a {
				color: #0e90d2;
				font-size: 0.9em;
				border: 1px solid #ddd;
				text-decoration: none;
				padding: 8px 12px;
			}
			
			.page a:hover {
				background-image: none;
				background-color: #ccc;
				color: #FFF;
			}
			
			.page strong {
				background-color: #0e90d2;
				padding: 4px 8px;
				color: #FFF;
				border: 1px solid #0e90d2;
				font-weight: normal;
			}
		</style>

		<div class="am-cf admin-main">
			<!-- sidebar start -->
			<div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
				<div class="am-offcanvas-bar admin-offcanvas-bar">
					<ul class="am-list admin-sidebar-list">
						<li>
							<a href="#"><span><img alt="{$user_info.name}" src="{$user_info.avatar}"  style="display: block; margin: 0 auto; width: 80%;border-radius: 50%;"></span> {$user_info.name}</a>
						</li>
						<li>
							<a href="/Home/Task/shouye"><span class="am-icon-home"></span> 首页</a>
						</li>
						<li class="nav-active">
							<a href="/Home/Server/index"><span class="am-icon-recycle"></span>服务器</a>
						</li>
						<li>
							<a href="/Home/Website/index"><span class="am-icon-th"></span>网站</a>
						</li>
						<li>
							<a href="/Home/Domain/index"><span class="am-icon-th"></span>域名</a>
						</li>
						<li>
							<a href="/Home/Master/index"><span class="am-icon-th"></span>主机</a>
						</li>
						<li>
							<a href="/Home/Database/index"><span class="am-icon-th"></span>数据库</a>
						</li>
						<li>
							<a href="/Home/Reverse/index"><span class="am-icon-th"></span>代理</a>
						</li>
					</ul>

				</div>
			</div>
			<!-- sidebar end -->

			<!-- content start -->
			<div class="admin-content">
				<div class="admin-content-body">
					<div class="am-cf am-my-title">{$meta_title}</div>
					<div class="am-g am-my-margin1">
						<div class="am-u-md-4">&nbsp;&nbsp;</div>
						<div class="am-u-md-8">
							<div class="am-btn-toolbar am-u-md-3 am-margin-right">
								<a href="{:U('Home/Server/addserver')}">
									<div class="am-btn-group am-btn-group-xs">
										<button type="button" class="am-btn am-btn-default" style="font-size: 1.4rem;"><span class="am-icon-plus"></span> 新增</button>
									</div>
								</a>
							</div>
							<div class="am-input-group am-input-group-sm">
								<input type="text" class="am-form-field" id="so_server" placeholder="请输入服务器名称/IP">
								<span class="am-input-group-btn">
			            <button class="am-btn am-btn-default" type="button" id="search">搜索</button>
			          </span>
							</div>
						</div>
					</div>

					<div class="am-g">
						<div class="am-u-sm-12">
							<div class="am-bg-white table-body">
								<table class="am-table am-table-striped am-table-hover table-main">
								<thead>
									<tr>
										<th>名称</th>
										<th>客户</th>
										<th>到期时间</th>
										<th>服务器IP</th>
										<!-- 	<th >管理账号</th>
					<th >操作系统</th>
					<th >供应商</th> -->
										<th>位置</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<volist name="data_list" id="vo" key="k">
										<tr>

											<td>
												<a href="javascript:;" onclick="serverInfo({$vo.id});">{$vo.server_name}</a>
											</td>
											<td>
												<a href="javascript:;" onclick="customerInfo({$vo.kh_id});">{$vo.customer_id}</a>
											</td>
											<td>{$vo.e_time}</td>
											<td>{$vo.ip} </td>
											<!-- <td >{$vo.account}</td> 
					<td >{$vo.system}</td>
					<td >{$vo.supplier}</td>-->
											<td>{$vo.place}</td>

											<td>
												<div class="am-btn-toolbar">
													<div class="am-btn-group am-btn-group-xs">
														<a href="{:U('Home/Server/editserver',array('id'=>$vo['id']))}">
															<button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>
														</a>
														<a href="javascript:;" onclick="getservice({$vo.id},'Server');">
									                      <button class="am-btn am-btn-default am-btn-xs am-text-secondary" ><span class="am-icon-file"></span> 服务</button>
									                      </a>
														<!-- 
		                      <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="del_server({$vo['id']});"><span class="am-icon-trash-o"></span> 删除</button>
		                     -->
													</div>
												</div>
											</td>
										</tr>
									</volist>

								</tbody>
							</table>

							<div class="page">
								{$page}
							</div>
							</div>
						</div>
					</div>

				</div>

			</div>
			<!-- content end -->

		</div>

		<script type="text/javascript">
			//搜索服务器
			$('#search').click(function() {
				var keyword = $('#so_server').val();
				window.location.href = '/Home/Server/index/keyword/' + keyword;

			});

			//删除
			function del_server(id) {
				DingTalkPC.device.notification.confirm({
					message: "您确定删除此信息吗？",
					title: "操作提示",
					buttonLabels: ['确定', '取消'],
					onSuccess: function(result) {
						/*
						{
						    buttonIndex: 0 //被点击按钮的索引值，Number类型，从0开始
						}
						*/
						if(result.buttonIndex == 0) {
							var params = {};
							params.id = id;
							var url = "{:U('Home/Server/delServerAjax')}";
							$.post(url, params, function(data) {
								if(data.info == 1) {
									DingTalkPC.device.notification.toast({
										type: "success", //toast的类型 alert, success, error, warning, information, confirm
										text: '删除成功！', //提示信息
										duration: 3, //显示持续时间，单位秒，最短2秒，最长5秒
										delay: 0, //延迟显示，单位秒，默认0, 最大限制为10
										onSuccess: function(result) {
											/*{}*/
										},
										onFail: function(err) {}
									})

									window.location.reload();
								} else {
									DingTalkPC.device.notification.toast({
										type: "error", //toast的类型 alert, success, error, warning, information, confirm
										text: '删除失败！', //提示信息
										duration: 3, //显示持续时间，单位秒，最短2秒，最长5秒
										delay: 0, //延迟显示，单位秒，默认0, 最大限制为10
										onSuccess: function(result) {
											/*{}*/
										},
										onFail: function(err) {}
									})
								}

							});
						}

					},
					onFail: function(err) {}
				});

			}

			function serverInfo(id) {

				var host = "{$HTTP_HOST}";
				DingTalkPC.biz.util.openModal({
					size: 'meddle', // modal的尺寸
					url: host + "/Home/Server/serverinfo/id/" + id, //打开modal的内容的url
					title: '服务器详情', //顶部标题
					onSuccess: function(result) {
						/*
						     调用biz.navigation.quit接口进入onSuccess, result为调用biz.navigation.quit传入的数值
						 */
					},
					onFail: function() {
						/*
						    tips:点击左上角关闭按钮会进入onFail
						 */
					}
				})
			}

			function customerInfo(id) {

				var host = "{$HTTP_HOST}";
				DingTalkPC.biz.util.openModal({
					size: 'meddle', // modal的尺寸
					url: host + "/Home/Customer/customerinfo/id/" + id, //打开modal的内容的url
					title: '客户详情', //顶部标题
					onSuccess: function(result) {
						/*
						     调用biz.navigation.quit接口进入onSuccess, result为调用biz.navigation.quit传入的数值
						 */
					},
					onFail: function() {
						/*
						    tips:点击左上角关闭按钮会进入onFail
						 */
					}
				})
			}
			//获取服务信息
			function getservice(id,type) {

				var host = "{$HTTP_HOST}";
				DingTalkPC.biz.util.openModal({
					size: 'meddle', // modal的尺寸
					url: host + "/Home/Service/getservice/id/" + id+"/type/"+type, //打开modal的内容的url
					title: '服务信息', //顶部标题
					onSuccess: function(result) {
						
					},
					onFail: function() {
						
					}
				})
			}
			
		</script>

		<script src="__ROOT__/Application/Home/View/default/assets/js/jquery.min.js"></script>

		<script src="__ROOT__/Application/Home/View/default/assets/js/amazeui.min.js"></script>
		<script src="__ROOT__/Application/Home/View/default/assets/js/app.js"></script>
	</body>

</html>